package com.itheima.homework.Date类;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class Demo1 {
    public static void main(String[] args) throws ParseException {
        Date date=new Date();
        long time = date.getTime();
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入生日:");
        String birthday = sc.next();
        SimpleDateFormat sdf=new SimpleDateFormat("YYYY-MM-dd");
        Date parse = sdf.parse(birthday);
        long time1 = parse.getTime();
        if(time1>time){
            System.out.println("生日必须早于当前日期");
            System.exit(0);
        }
        long l = time-time1;
        System.out.println("来到这个世界"+(l/1000L/3600/24)+"天");
    }
}
